package com.felight.list;

import java.util.ArrayList;
import java.util.Collections;
/**Creates an ArrayList and stores String values inside the list.
 * @author soumya
 *
 */
public class ArraylistDemo {
public static void main(String[] args) {
	ArrayList<String> lst=new ArrayList<String>(); //ArrayList which stores only String is Created
	String s1="hello";
	lst.add(s1);     //add() method adds String to ArrayList
	String s="hi";
	lst.add(s);
	lst.add("soumya");
	lst.add("yashu");
	System.out.println("Size of arraylist is:"+lst.size());//size() tells the number the elements in the List
	System.out.println("Elemenet at 0th position:"+lst.get(0));
	lst.remove(2);
	System.out.println("Size of arrayList after removing an element:"+lst.size());
	Collections.sort(lst);  //This will sort the ArrayList elements
	for(String str:lst)
	{
		System.out.println(str);
	}
	
  }
}
